import React, { Component } from 'react'
import {connect} from 'react-redux'
import {List,InputItem,WingBlank,WhiteSpace,Button} from 'antd-mobile'
import '@/common/css/login.scss'
import handleChange from '@/components/handleChange'
import Logo from '@/components/Logo'
import { LoginAction } from '@/config/service';
//antd-mobile
export interface CenterProps {
  state:any;
  handleChange: (active:string,v:string) => void;
  username:string;
  password:string
}

class Login extends Component<CenterProps> {
  constructor(props: CenterProps) {
      super(props);
	  this.state={};
   };
   Loginin(){
	  const {username, password} = this.props.state
	  let parms={
		  username:username,
		  password:password
	  }
	  LoginAction(parms).then(response => {
		  
	  })
   }
    render(){
		 const {handleChange} = this.props;
		  const {username, password} = this.props.state
        return (
		     <div className="login-page">
             <WingBlank>
			     <Logo></Logo>
                 <List className="form">
                     <InputItem
                     clear
                     placeholder="输入用户名"
                     value={username} 
                     onChange={v=>handleChange('username',v)}>用户名</InputItem>
                     <InputItem
                     clear
                     type="password"
                     placeholder="输入密码"
                     value={password} 
                     onChange={v=>handleChange('password',v)}>密码</InputItem>
                 </List>
                 <WhiteSpace/>
                 <Button type="primary"  onClick={this.Loginin.bind(this)}>登录</Button>
                 <WhiteSpace/>
                 <Button type="primary">注册</Button>
             </WingBlank>
			 </div>
        )
    }
}

export default connect()(handleChange(Login))

